import smtplib
from email.mime.text import MIMEText
from email.header import Header


def send_eamil(text):
    mail_host = 'smtp.qq.com'
    mail_user = '616015803@qq.com'
    mail_pass = 'uwdrkapowgbvbddi'

    sender = '616015803@qq.com'
    receivers = ['616015803@qq.com']

    title = 'Python Program'

    message = MIMEText(text, 'plain', 'utf-8')
    message['From'] = '{}'.format(sender)
    message['To'] = ','.join(receivers)
    message['Subject'] = title
    try:
        smtpObj = smtplib.SMTP_SSL(mail_host, 465)
        smtpObj.login(mail_user, mail_pass)
        smtpObj.sendmail(sender, receivers, message.as_string())
        print('mail has been send successfully')
    except Exception:
        print('mail drop')


if __name__ == "__main__":
    send_eamil('test')
